// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------

#pragma once

namespace Common
{
    //
    // This file contains the classes that convert the enums in our IDL file to strings, used by the JSON serializer
    //

    //
    // Template class for serializing enum's that are not in a specific namespace - eg: idl enum's.
    // Specializations for this class should be explicitly setup.
    //
    template<class T>
    struct EnumJsonSerializer
    {
        static const bool Marker = false;
    };

    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // NOTE: The strings for the enum's below should match the corresponding managed enum.
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_PLACEMENT_POLICY_TYPE)
        ADD_IDL_ENUM_VALUE(FABRIC_PLACEMENT_POLICY_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_PLACEMENT_POLICY_INVALID_DOMAIN, L"InvalidDomain")
        ADD_IDL_ENUM_VALUE(FABRIC_PLACEMENT_POLICY_REQUIRED_DOMAIN, L"RequireDomain")
        ADD_IDL_ENUM_VALUE(FABRIC_PLACEMENT_POLICY_PREFERRED_PRIMARY_DOMAIN, L"PreferPrimaryDomain")
        ADD_IDL_ENUM_VALUE(FABRIC_PLACEMENT_POLICY_REQUIRED_DOMAIN_DISTRIBUTION, L"RequireDomainDistribution")
        ADD_IDL_ENUM_VALUE(FABRIC_PLACEMENT_POLICY_NONPARTIALLY_PLACE_SERVICE, L"NonPartiallyPlaceService")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_HEALTH_STATE)
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_STATE_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_STATE_OK, L"Ok")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_STATE_WARNING, L"Warning")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_STATE_ERROR, L"Error")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_STATE_UNKNOWN, L"Unknown")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_NODE_DEACTIVATION_TASK_TYPE)
        ADD_IDL_ENUM_VALUE(FABRIC_NODE_DEACTIVATION_TASK_TYPE_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_NODE_DEACTIVATION_TASK_TYPE_INFRASTRUCTURE, L"Infrastructure")
        ADD_IDL_ENUM_VALUE(FABRIC_NODE_DEACTIVATION_TASK_TYPE_REPAIR, L"Repair")
        ADD_IDL_ENUM_VALUE(FABRIC_NODE_DEACTIVATION_TASK_TYPE_CLIENT, L"Client")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_NODE_DEACTIVATION_INTENT)
        ADD_IDL_ENUM_VALUE(FABRIC_NODE_DEACTIVATION_INTENT_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_NODE_DEACTIVATION_INTENT_PAUSE, L"Pause")
        ADD_IDL_ENUM_VALUE(FABRIC_NODE_DEACTIVATION_INTENT_RESTART, L"Restart")
        ADD_IDL_ENUM_VALUE(FABRIC_NODE_DEACTIVATION_INTENT_REMOVE_DATA, L"RemoveData")
        ADD_IDL_ENUM_VALUE(FABRIC_NODE_DEACTIVATION_INTENT_REMOVE_NODE, L"RemoveNode")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_NODE_DEACTIVATION_STATUS)
        ADD_IDL_ENUM_VALUE(FABRIC_NODE_DEACTIVATION_STATUS_NONE, L"None")
        ADD_IDL_ENUM_VALUE(FABRIC_NODE_DEACTIVATION_STATUS_SAFETY_CHECK_IN_PROGRESS, L"SafetyCheckInProgress")
        ADD_IDL_ENUM_VALUE(FABRIC_NODE_DEACTIVATION_STATUS_SAFETY_CHECK_COMPLETE, L"SafetyCheckComplete")
        ADD_IDL_ENUM_VALUE(FABRIC_NODE_DEACTIVATION_STATUS_COMPLETED, L"Completed")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_QUERY_NODE_STATUS)
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_NODE_STATUS_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_NODE_STATUS_UP, L"Up")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_NODE_STATUS_DOWN, L"Down")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_NODE_STATUS_ENABLING, L"Enabling")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_NODE_STATUS_DISABLING, L"Disabling")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_NODE_STATUS_DISABLED, L"Disabled")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_NODE_STATUS_UNKNOWN, L"Unknown")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_NODE_STATUS_REMOVED, L"Removed")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_SERVICE_KIND)
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_KIND_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_KIND_STATELESS, L"Stateless")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_KIND_STATEFUL, L"Stateful")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_QUERY_SERVICE_STATUS)
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_STATUS_UNKNOWN, L"Unknown")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_STATUS_ACTIVE, L"Active")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_STATUS_UPGRADING, L"Upgrading")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_STATUS_DELETING, L"Deleting")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_STATUS_CREATING, L"Creating")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_STATUS_FAILED, L"Failed")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_SERVICE_PARTITION_KIND)
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_PARTITION_KIND_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_PARTITION_KIND_SINGLETON, L"Singleton")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_PARTITION_KIND_INT64_RANGE, L"Int64Range")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_PARTITION_KIND_NAMED, L"Named")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_TEST_COMMAND_PROGRESS_STATE)
        ADD_IDL_ENUM_VALUE(FABRIC_TEST_COMMAND_PROGRESS_STATE_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_TEST_COMMAND_PROGRESS_STATE_RUNNING, L"Running")
        ADD_IDL_ENUM_VALUE(FABRIC_TEST_COMMAND_PROGRESS_STATE_ROLLING_BACK, L"RollingBack")
        ADD_IDL_ENUM_VALUE(FABRIC_TEST_COMMAND_PROGRESS_STATE_COMPLETED, L"Completed")
        ADD_IDL_ENUM_VALUE(FABRIC_TEST_COMMAND_PROGRESS_STATE_FAULTED, L"Faulted")
        ADD_IDL_ENUM_VALUE(FABRIC_TEST_COMMAND_PROGRESS_STATE_CANCELLED, L"Cancelled")
        ADD_IDL_ENUM_VALUE(FABRIC_TEST_COMMAND_PROGRESS_STATE_FORCE_CANCELLED, L"ForceCancelled")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_TEST_COMMAND_TYPE)
        ADD_IDL_ENUM_VALUE(FABRIC_TEST_COMMAND_TYPE_DEFAULT, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_TEST_COMMAND_TYPE_INVOKE_DATA_LOSS, L"PartitionDataLoss")
        ADD_IDL_ENUM_VALUE(FABRIC_TEST_COMMAND_TYPE_INVOKE_QUORUM_LOSS, L"PartitionQuorumLoss")
        ADD_IDL_ENUM_VALUE(FABRIC_TEST_COMMAND_TYPE_INVOKE_RESTART_PARTITION, L"PartitionRestart")
        ADD_IDL_ENUM_VALUE(FABRIC_TEST_COMMAND_TYPE_START_NODE_TRANSITION, L"NodeTransition")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_CHAOS_EVENT_KIND)
        ADD_IDL_ENUM_VALUE(FABRIC_CHAOS_EVENT_KIND_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_CHAOS_EVENT_KIND_STARTED, L"Started")
        ADD_IDL_ENUM_VALUE(FABRIC_CHAOS_EVENT_KIND_EXECUTING_FAULTS, L"ExecutingFaults")
        ADD_IDL_ENUM_VALUE(FABRIC_CHAOS_EVENT_KIND_WAITING, L"Waiting")
        ADD_IDL_ENUM_VALUE(FABRIC_CHAOS_EVENT_KIND_VALIDATION_FAILED, L"ValidationFailed")
        ADD_IDL_ENUM_VALUE(FABRIC_CHAOS_EVENT_KIND_TEST_ERROR, L"TestError")
        ADD_IDL_ENUM_VALUE(FABRIC_CHAOS_EVENT_KIND_STOPPED, L"Stopped")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_CHAOS_STATUS)
        ADD_IDL_ENUM_VALUE(FABRIC_CHAOS_STATUS_INVALID, L"None")
        ADD_IDL_ENUM_VALUE(FABRIC_CHAOS_STATUS_RUNNING, L"Running")
        ADD_IDL_ENUM_VALUE(FABRIC_CHAOS_STATUS_STOPPED, L"Stopped")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_HEALTH_EVALUATION_KIND)
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_EVENT, L"Event")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_REPLICAS, L"Replicas")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_PARTITIONS, L"Partitions")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_DEPLOYED_SERVICE_PACKAGES, L"DeployedServicePackages")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_DEPLOYED_APPLICATIONS, L"DeployedApplications")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_SERVICES, L"Services")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_NODES, L"Nodes")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_APPLICATIONS, L"Applications")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_SYSTEM_APPLICATION, L"SystemApplication")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_UPGRADE_DOMAIN_DEPLOYED_APPLICATIONS, L"UpgradeDomainDeployedApplications")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_UPGRADE_DOMAIN_NODES, L"UpgradeDomainNodes")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_NODE, L"Node")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_REPLICA, L"Replica")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_PARTITION, L"Partition")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_SERVICE, L"Service")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_DEPLOYED_SERVICE_PACKAGE, L"DeployedServicePackage")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_DEPLOYED_APPLICATION, L"DeployedApplication")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_APPLICATION, L"Application")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_DELTA_NODES_CHECK, L"DeltaNodesCheck")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_UPGRADE_DOMAIN_DELTA_NODES_CHECK, L"UpgradeDomainDeltaNodesCheck")
        ADD_IDL_ENUM_VALUE(FABRIC_HEALTH_EVALUATION_KIND_APPLICATION_TYPE_APPLICATIONS, L"ApplicationTypeApplications")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_PROPERTY_TYPE_ID)
        ADD_IDL_ENUM_VALUE(FABRIC_PROPERTY_TYPE_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_PROPERTY_TYPE_BINARY, L"Binary")
        ADD_IDL_ENUM_VALUE(FABRIC_PROPERTY_TYPE_INT64, L"Int64")
        ADD_IDL_ENUM_VALUE(FABRIC_PROPERTY_TYPE_DOUBLE, L"Double")
        ADD_IDL_ENUM_VALUE(FABRIC_PROPERTY_TYPE_WSTRING, L"String")
        ADD_IDL_ENUM_VALUE(FABRIC_PROPERTY_TYPE_GUID, L"Guid")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_PROPERTY_BATCH_OPERATION_KIND)
        ADD_IDL_ENUM_VALUE(FABRIC_PROPERTY_BATCH_OPERATION_KIND_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_PROPERTY_BATCH_OPERATION_KIND_PUT, L"Put")
        ADD_IDL_ENUM_VALUE(FABRIC_PROPERTY_BATCH_OPERATION_KIND_GET, L"Get")
        ADD_IDL_ENUM_VALUE(FABRIC_PROPERTY_BATCH_OPERATION_KIND_CHECK_EXISTS, L"CheckExists")
        ADD_IDL_ENUM_VALUE(FABRIC_PROPERTY_BATCH_OPERATION_KIND_CHECK_SEQUENCE, L"CheckSequence")
        ADD_IDL_ENUM_VALUE(FABRIC_PROPERTY_BATCH_OPERATION_KIND_DELETE, L"Delete")
        ADD_IDL_ENUM_VALUE(FABRIC_PROPERTY_BATCH_OPERATION_KIND_CHECK_VALUE, L"CheckValue")
    END_DEFINE_IDL_ENUM_SERIALIZER()
	
	BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_REPLICA_ROLE)
        ADD_IDL_ENUM_VALUE(FABRIC_REPLICA_ROLE_UNKNOWN, L"Unknown")
        ADD_IDL_ENUM_VALUE(FABRIC_REPLICA_ROLE_NONE, L"None")
        ADD_IDL_ENUM_VALUE(FABRIC_REPLICA_ROLE_PRIMARY, L"Primary")
        ADD_IDL_ENUM_VALUE(FABRIC_REPLICA_ROLE_IDLE_SECONDARY, L"IdleSecondary")
        ADD_IDL_ENUM_VALUE(FABRIC_REPLICA_ROLE_ACTIVE_SECONDARY, L"ActiveSecondary")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_QUERY_SERVICE_REPLICA_STATUS)
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_REPLICA_STATUS_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_REPLICA_STATUS_INBUILD, L"InBuild")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_REPLICA_STATUS_STANDBY, L"Standby")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_REPLICA_STATUS_READY, L"Ready")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_REPLICA_STATUS_DOWN, L"Down")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_REPLICA_STATUS_DROPPED, L"Dropped")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_QUERY_SERVICE_PARTITION_STATUS)
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_PARTITION_STATUS_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_PARTITION_STATUS_READY, L"Ready")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_PARTITION_STATUS_NOT_READY, L"NotReady")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_PARTITION_STATUS_IN_QUORUM_LOSS, L"InQuorumLoss")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_PARTITION_STATUS_RECONFIGURING, L"Reconfiguring")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_PARTITION_STATUS_DELETING, L"Deleting")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_SERVICE_TYPE_REGISTRATION_STATUS)
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_TYPE_REGISTRATION_STATUS_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_TYPE_REGISTRATION_STATUS_DISABLED, L"Disabled")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_TYPE_REGISTRATION_STATUS_NOT_REGISTERED, L"NotRegistered")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_TYPE_REGISTRATION_STATUS_REGISTERED, L"Registered")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    /* !!!!! There is no managed enum corresponding to this. !!!!!!*/
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_UPGRADE_KIND)
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_KIND_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_KIND_ROLLING, L"Rolling")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_ROLLING_UPGRADE_MODE)
        ADD_IDL_ENUM_VALUE(FABRIC_ROLLING_UPGRADE_MODE_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_ROLLING_UPGRADE_MODE_UNMONITORED_AUTO, L"UnmonitoredAuto")
        ADD_IDL_ENUM_VALUE(FABRIC_ROLLING_UPGRADE_MODE_UNMONITORED_MANUAL, L"UnmonitoredManual")
        ADD_IDL_ENUM_VALUE(FABRIC_ROLLING_UPGRADE_MODE_MONITORED, L"Monitored")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_SERVICE_LOAD_METRIC_WEIGHT)
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_LOAD_METRIC_WEIGHT_ZERO, L"Zero")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_LOAD_METRIC_WEIGHT_LOW, L"Low")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_LOAD_METRIC_WEIGHT_MEDIUM, L"Medium")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_LOAD_METRIC_WEIGHT_HIGH, L"High")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_SERVICE_DESCRIPTION_KIND)
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_DESCRIPTION_KIND_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_DESCRIPTION_KIND_STATELESS, L"Stateless")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_DESCRIPTION_KIND_STATEFUL, L"Stateful")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_SERVICE_REPLICA_KIND)
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_REPLICA_KIND_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_REPLICA_KIND_KEY_VALUE_STORE, L"KeyValueStore")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_QUERY_SERVICE_OPERATION_NAME)
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_OPERATION_NAME_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_OPERATION_NAME_NONE, L"None")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_OPERATION_NAME_OPEN, L"Open")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_OPERATION_NAME_CHANGEROLE, L"ChangeRole")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_OPERATION_NAME_CLOSE, L"Close")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_SERVICE_OPERATION_NAME_ABORT, L"Abort")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_QUERY_REPLICATOR_OPERATION_NAME)
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_REPLICATOR_OPERATION_NAME_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_REPLICATOR_OPERATION_NAME_NONE, L"None")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_REPLICATOR_OPERATION_NAME_OPEN, L"Open")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_REPLICATOR_OPERATION_NAME_CHANGEROLE, L"ChangeRole")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_REPLICATOR_OPERATION_NAME_UPDATEEPOCH, L"UpdateEpoch")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_REPLICATOR_OPERATION_NAME_CLOSE, L"Close")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_REPLICATOR_OPERATION_NAME_ABORT, L"Abort")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_REPLICATOR_OPERATION_NAME_ONDATALOSS, L"OnDataLoss")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_REPLICATOR_OPERATION_NAME_WAITFORCATCHUP, L"WaitForCatchup")
        ADD_IDL_ENUM_VALUE(FABRIC_QUERY_REPLICATOR_OPERATION_NAME_BUILD, L"Build")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_SERVICE_PARTITION_ACCESS_STATUS)
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_PARTITION_ACCESS_STATUS_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_PARTITION_ACCESS_STATUS_GRANTED, L"Granted")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_PARTITION_ACCESS_STATUS_RECONFIGURATION_PENDING, L"ReconfigurationPending")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_PARTITION_ACCESS_STATUS_NOT_PRIMARY, L"NotPrimary")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_PARTITION_ACCESS_STATUS_NO_WRITE_QUORUM, L"NoWriteQuorum")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_PACKAGE_SHARING_POLICY_SCOPE)
        ADD_IDL_ENUM_VALUE(FABRIC_PACKAGE_SHARING_POLICY_SCOPE_NONE, L"None")
        ADD_IDL_ENUM_VALUE(FABRIC_PACKAGE_SHARING_POLICY_SCOPE_ALL, L"All")
        ADD_IDL_ENUM_VALUE(FABRIC_PACKAGE_SHARING_POLICY_SCOPE_CODE, L"Code")
        ADD_IDL_ENUM_VALUE(FABRIC_PACKAGE_SHARING_POLICY_SCOPE_CONFIG, L"Config")
        ADD_IDL_ENUM_VALUE(FABRIC_PACKAGE_SHARING_POLICY_SCOPE_DATA, L"Data")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_SERVICE_CORRELATION_SCHEME)
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_CORRELATION_SCHEME_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_CORRELATION_SCHEME_AFFINITY, L"Affinity")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_CORRELATION_SCHEME_ALIGNED_AFFINITY, L"AlignedAffinity")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_CORRELATION_SCHEME_NONALIGNED_AFFINITY, L"NonAlignedAffinity")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    /* !!!!! There is no managed enum corresponding to this. !!!!!!*/    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_STATEFUL_SERVICE_FAILOVER_SETTINGS_FLAGS)
        ADD_IDL_ENUM_VALUE(FABRIC_STATEFUL_SERVICE_SETTINGS_NONE, L"FABRIC_STATEFUL_SERVICE_SETTINGS_NONE")
        ADD_IDL_ENUM_VALUE(FABRIC_STATEFUL_SERVICE_SETTINGS_REPLICA_RESTART_WAIT_DURATION, L"FABRIC_STATEFUL_SERVICE_SETTINGS_REPLICA_RESTART_WAIT_DURATION")
        ADD_IDL_ENUM_VALUE(FABRIC_STATEFUL_SERVICE_SETTINGS_QUORUM_LOSS_WAIT_DURATION, L"FABRIC_STATEFUL_SERVICE_SETTINGS_QUORUM_LOSS_WAIT_DURATION")
        ADD_IDL_ENUM_VALUE(FABRIC_STATEFUL_SERVICE_SETTINGS_STANDBY_REPLICA_KEEP_DURATION, L"FABRIC_STATEFUL_SERVICE_SETTINGS_STANDBY_REPLICA_KEEP_DURATION")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_MOVE_COST)
        ADD_IDL_ENUM_VALUE(FABRIC_MOVE_COST_ZERO, L"Zero")
        ADD_IDL_ENUM_VALUE(FABRIC_MOVE_COST_LOW, L"Low")
        ADD_IDL_ENUM_VALUE(FABRIC_MOVE_COST_MEDIUM, L"Medium")
        ADD_IDL_ENUM_VALUE(FABRIC_MOVE_COST_HIGH, L"High")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_SERVICE_ENDPOINT_ROLE)
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_ROLE_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_ROLE_STATELESS, L"Stateless")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_ROLE_STATEFUL_PRIMARY, L"StatefulPrimary")
        ADD_IDL_ENUM_VALUE(FABRIC_SERVICE_ROLE_STATEFUL_SECONDARY, L"StatefulSecondary")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE)
        ADD_IDL_ENUM_VALUE(FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_PROVISIONING_TARGET, L"ProvisioningTarget")
        ADD_IDL_ENUM_VALUE(FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_ROLLING_FORWARD_IN_PROGRESS, L"RollingForwardInProgress")
        ADD_IDL_ENUM_VALUE(FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_ROLLING_FORWARD_PENDING, L"RollingForwardPending")
        ADD_IDL_ENUM_VALUE(FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_UNPROVISIONING_CURRENT, L"UnprovisioningCurrent")
        ADD_IDL_ENUM_VALUE(FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_ROLLING_FORWARD_COMPLETED, L"RollingForwardCompleted")
        ADD_IDL_ENUM_VALUE(FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_ROLLING_BACK_IN_PROGRESS, L"RollingBackInProgress")
        ADD_IDL_ENUM_VALUE(FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_UNPROVISIONING_TARGET, L"UnprovisioningTarget")
        ADD_IDL_ENUM_VALUE(FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_ROLLING_BACK_COMPLETED, L"RollingBackCompleted")
        ADD_IDL_ENUM_VALUE(FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_STATE_FAILED, L"Failed")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_APPLICATION_UPGRADE_STATE)
        ADD_IDL_ENUM_VALUE(FABRIC_APPLICATION_UPGRADE_STATE_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_APPLICATION_UPGRADE_STATE_ROLLING_BACK_IN_PROGRESS, L"RollingBackInProgress")
        ADD_IDL_ENUM_VALUE(FABRIC_APPLICATION_UPGRADE_STATE_ROLLING_BACK_COMPLETED, L"RollingBackCompleted")
        ADD_IDL_ENUM_VALUE(FABRIC_APPLICATION_UPGRADE_STATE_ROLLING_FORWARD_PENDING, L"RollingForwardPending")
        ADD_IDL_ENUM_VALUE(FABRIC_APPLICATION_UPGRADE_STATE_ROLLING_FORWARD_IN_PROGRESS, L"RollingForwardInProgress")
        ADD_IDL_ENUM_VALUE(FABRIC_APPLICATION_UPGRADE_STATE_ROLLING_FORWARD_COMPLETED, L"RollingForwardCompleted")
        ADD_IDL_ENUM_VALUE(FABRIC_APPLICATION_UPGRADE_STATE_FAILED, L"Failed")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_UPGRADE_FAILURE_REASON)
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_FAILURE_REASON_NONE, L"None")
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_FAILURE_REASON_INTERRUPTED, L"Interrupted")
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_FAILURE_REASON_HEALTH_CHECK, L"HealthCheck")
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_FAILURE_REASON_UPGRADE_DOMAIN_TIMEOUT, L"UpgradeDomainTimeout")
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_FAILURE_REASON_OVERALL_UPGRADE_TIMEOUT, L"OverallUpgradeTimeout")
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_FAILURE_REASON_PROCESSING_FAILURE, L"ProcessingFailure")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_UPGRADE_DOMAIN_STATE)
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_DOMAIN_STATE_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_DOMAIN_STATE_PENDING, L"Pending")
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_DOMAIN_STATE_IN_PROGRESS, L"InProgress")
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_DOMAIN_STATE_COMPLETED, L"Completed")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_PARTITION_SELECTOR_TYPE)
        ADD_IDL_ENUM_VALUE(FABRIC_PARTITION_SELECTOR_TYPE_NONE, L"None")
        ADD_IDL_ENUM_VALUE(FABRIC_PARTITION_SELECTOR_TYPE_SINGLETON, L"Singleton")
        ADD_IDL_ENUM_VALUE(FABRIC_PARTITION_SELECTOR_TYPE_NAMED, L"Named")
        ADD_IDL_ENUM_VALUE(FABRIC_PARTITION_SELECTOR_TYPE_UNIFORM_INT64, L"UniformInt64")
        ADD_IDL_ENUM_VALUE(FABRIC_PARTITION_SELECTOR_TYPE_PARTITION_ID, L"PartitionId")
        ADD_IDL_ENUM_VALUE(FABRIC_PARTITION_SELECTOR_TYPE_RANDOM, L"Random")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_RESTART_PARTITION_MODE)
        ADD_IDL_ENUM_VALUE(FABRIC_RESTART_PARTITION_MODE_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_RESTART_PARTITION_MODE_ALL_REPLICAS_OR_INSTANCES, L"AllReplicasOrInstances")
        ADD_IDL_ENUM_VALUE(FABRIC_RESTART_PARTITION_MODE_ONLY_ACTIVE_SECONDARIES, L"OnlyActiveSecondaries")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_QUORUM_LOSS_MODE)
        ADD_IDL_ENUM_VALUE(FABRIC_QUORUM_LOSS_MODE_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_QUORUM_LOSS_MODE_QUORUM_REPLICAS, L"QuorumReplicas")
        ADD_IDL_ENUM_VALUE(FABRIC_QUORUM_LOSS_MODE_ALL_REPLICAS, L"AllReplicas")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_DATA_LOSS_MODE)
        ADD_IDL_ENUM_VALUE(FABRIC_DATA_LOSS_MODE_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_DATA_LOSS_MODE_PARTIAL, L"PartialDataLoss")
        ADD_IDL_ENUM_VALUE(FABRIC_DATA_LOSS_MODE_FULL, L"FullDataLoss")
    END_DEFINE_IDL_ENUM_SERIALIZER()
    
    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_UPGRADE_STATE)
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_STATE_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_STATE_ROLLING_BACK_IN_PROGRESS, L"RollingBackInProgress")
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_STATE_ROLLING_BACK_COMPLETED, L"RollingBackCompleted")
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_STATE_ROLLING_FORWARD_PENDING, L"RollingForwardPending")
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_STATE_ROLLING_FORWARD_IN_PROGRESS, L"RollingForwardInProgress")
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_STATE_ROLLING_FORWARD_COMPLETED, L"RollingForwardCompleted")
        ADD_IDL_ENUM_VALUE(FABRIC_UPGRADE_STATE_FAILED, L"Failed")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_APPLICATION_DEFINITION_KIND)
        ADD_IDL_ENUM_VALUE(FABRIC_APPLICATION_DEFINITION_KIND_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_APPLICATION_DEFINITION_KIND_SERVICE_FABRIC_APPLICATION_DESCRIPTION, L"ServiceFabricApplicationDescription")
        ADD_IDL_ENUM_VALUE(FABRIC_APPLICATION_DEFINITION_KIND_COMPOSE, L"Compose")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_APPLICATION_TYPE_DEFINITION_KIND)
        ADD_IDL_ENUM_VALUE(FABRIC_APPLICATION_TYPE_DEFINITION_KIND_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_APPLICATION_TYPE_DEFINITION_KIND_SERVICE_FABRIC_APPLICATION_PACKAGE, L"ServiceFabricApplicationPackage")
        ADD_IDL_ENUM_VALUE(FABRIC_APPLICATION_TYPE_DEFINITION_KIND_COMPOSE, L"Compose")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_RECONFIGURATION_PHASE)
        ADD_IDL_ENUM_VALUE(FABRIC_RECONFIGURATION_PHASE_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_RECONFIGURATION_PHASE_NONE, L"None")
        ADD_IDL_ENUM_VALUE(FABRIC_RECONFIGURATION_PHASE_ZERO, L"Zero")
        ADD_IDL_ENUM_VALUE(FABRIC_RECONFIGURATION_PHASE_ONE, L"One")
        ADD_IDL_ENUM_VALUE(FABRIC_RECONFIGURATION_PHASE_TWO, L"Two")
        ADD_IDL_ENUM_VALUE(FABRIC_RECONFIGURATION_PHASE_THREE, L"Three")
        ADD_IDL_ENUM_VALUE(FABRIC_RECONFIGURATION_PHASE_FOUR, L"Four")
        ADD_IDL_ENUM_VALUE(FABRIC_RECONFIGURATION_ABORT_PHASE_ZERO, L"AbortPhaseZero")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_RECONFIGURATION_TYPE)
        ADD_IDL_ENUM_VALUE(FABRIC_RECONFIGURATION_TYPE_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_RECONFIGURATION_TYPE_SWAPPRIMARY, L"SwapPrimary")
        ADD_IDL_ENUM_VALUE(FABRIC_RECONFIGURATION_TYPE_FAILOVER, L"Failover")
        ADD_IDL_ENUM_VALUE(FABRIC_RECONFIGURATION_TYPE_OTHER, L"Other")
        ADD_IDL_ENUM_VALUE(FABRIC_RECONFIGURATION_TYPE_NONE, L"None")
    END_DEFINE_IDL_ENUM_SERIALIZER()

    BEGIN_DEFINE_IDL_ENUM_JSON_SERIALIZER(FABRIC_PROVISION_APPLICATION_TYPE_KIND)
        ADD_IDL_ENUM_VALUE(FABRIC_PROVISION_APPLICATION_TYPE_KIND_INVALID, L"Invalid")
        ADD_IDL_ENUM_VALUE(FABRIC_PROVISION_APPLICATION_TYPE_KIND_EXTERNAL_STORE, L"ExternalStore")
        ADD_IDL_ENUM_VALUE(FABRIC_PROVISION_APPLICATION_TYPE_KIND_IMAGE_STORE_PATH, L"ImageStorePath")
    END_DEFINE_IDL_ENUM_SERIALIZER()
}
